package com.springboot.example.web.web;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import java.util.Date;
import java.util.Map;

/**
 * 作者: guo yao
 * 日期: 2016年02月22日
 * 时间: 下午15:29
 */

@Controller
@RequestMapping(value = "/user")
public class UserController {

    @Value("${application.message}")
    private String message;


    @RequestMapping("/indexMain.html")
    public ModelAndView index() {
        System.out.println("info index.html");
        ModelAndView mav = new ModelAndView();
        mav.addObject("time", new Date());
        mav.addObject("message", this.message);
        mav.setViewName("user/index_main");
        return mav;
    }
    /*@RequestMapping("/getUserList.html")
    public String index() {
        System.out.println("====3213123123====");
        return "user/user_list";
    }*/


    @RequestMapping("/indexFlt.html")
    public String indexFlt(Map<String, Object> model) {
        System.out.println("info index.html");
        model.put("time", new Date());
        model.put("message", this.message);
        return "user/index_free";
    }

    /*@RequestMapping("/index_free.html")
    public ModelAndView indexFree() {
        ModelAndView mav = new ModelAndView();
        System.out.println("info index.html");
        mav.addObject("time", new Date());
        mav.addObject("message", this.message);
        mav.setViewName("user/index_free");
        return mav;
    }*/

    @RequestMapping("/indexFree.html")
    public String indexFree(Map<String, Object> model) {
        System.out.println("info index.html");
        model.put("time", new Date());
        model.put("message", this.message);
        return "user/index_flt";
    }
}
